#ifndef _TEST_H_
#define _TEST_H_

#pragma once

#ifdef __cplusplus
extern "C" {
#endif

#include "BaseType.h"



typedef struct {
    WORD e_magic;
    WORD e_cblp;
    WORD e_cp;
    WORD e_crlc;
    WORD e_cparhdr;
    WORD e_minalloc;
    WORD e_maxalloc;
    WORD e_ss;
    WORD e_sp;
    WORD e_csum;
    WORD e_ip;
    WORD e_cs;
    WORD e_lfarlc;
    WORD e_ovno;
    WORD e_res[4];
    WORD e_oemid;
    WORD e_oeminfo;
    WORD e_res2[10];
    DWORD e_lfanew;
} IMAGE_DOS_HEADER;


typedef unsigned short IMAGE_FILE_MACHINE;

typedef unsigned short IMAGE_FILE_CHARACTER;

typedef struct {
    IMAGE_FILE_MACHINE Machine;
    WORD NumberOfSections;
    DWORD TimeDateStamp;
    DWORD PointerToSymbolTable;
    DWORD NumberOfSymbols;
    WORD SizeOfOptionalHeader;
    IMAGE_FILE_CHARACTER Characteristics;
} IMAGE_FILE_HEADER;

typedef unsigned short IMAGE_NT_OPTIONAL_MAGIC;

typedef unsigned short IMAGE_NT_SUBSYSTEM;

typedef struct {
    DWORD VirtualAddress;
    DWORD Size;
} IMAGE_DATA_DIRECTORY;


typedef ULONGLONG PEULONG;

typedef struct {
    IMAGE_NT_OPTIONAL_MAGIC Magic;
    BYTE MajorLinkerVersion;
    BYTE MinorLinkerVersion;
    DWORD SizeOfCode;
    DWORD SizeOfInitializedData;
    DWORD SizeOfUninitializedData;
    DWORD AddressOfEntryPoint;
    DWORD BaseOfCode;
    DWORD BaseOfData;
    PEULONG ImageBase;
    DWORD SectionAlignment;
    DWORD FileAlignment;
    WORD MajorOperatingSystemVersion;
    WORD MinorOperatingSystemVersion;
    WORD MajorImageVersion;
    WORD MinorImageVersion;
    WORD MajorSubsystemVersion;
    WORD MinorSubsystemVersion;
    DWORD Win32VersionValue;
    DWORD SizeOfImage;
    DWORD SizeOfHeaders;
    DWORD CheckSum;
    IMAGE_NT_SUBSYSTEM Subsystem;
    WORD DllCharacteristics;
    PEULONG SizeOfStackReserve;
    PEULONG SizeOfStackCommit;
    PEULONG SizeOfHeapReserve;
    PEULONG SizeOfHeapCommit;
    DWORD LoaderFlags;
    DWORD NumberOfRvaAndSizes;
    IMAGE_DATA_DIRECTORY DataDirectory[16];
} IMAGE_OPTIONAL_HEADER;

typedef struct {
    DWORD Signature;
    IMAGE_FILE_HEADER FileHeader;
    IMAGE_OPTIONAL_HEADER OptionalHeader;
} IMAGE_NT_HEADERS;

typedef unsigned int IMAGE_SECTION_CHARACTER;

typedef struct {
    BYTE Name[8];
    DWORD VirtualSize;
    DWORD VirtualAddress;
    DWORD SizeOfRawData;
    DWORD PointerToRawData;
    DWORD PointerToRelocations;
    DWORD PointerToLinenumbers;
    WORD NumberOfRelocations;
    WORD NumberOfLinenumbers;
    IMAGE_SECTION_CHARACTER Characteristics;
} IMAGE_SECTION_HEADER;

typedef struct {
    IMAGE_DOS_HEADER DOSHeader;
    BYTE *DOSData;
    IMAGE_NT_HEADERS NTHeader;
    IMAGE_SECTION_HEADER *Section;
    BYTE *data;
} IMAGE_PE_FILE;


// Global variable declaration, count=6
extern DWORD e_lfanew;
extern WORD NumberOfSections;
extern WORD SizeOfOptionalHeader;
extern DWORD FileAlignment;
extern OftLen DataDirectory;
extern OftLen Section;

// Type function declaration, count=13
void PauseIMAGE_DOS_HEADER(IMAGE_DOS_HEADER *val, char type);
void PauseIMAGE_FILE_MACHINE(IMAGE_FILE_MACHINE *val, char type);
void PauseIMAGE_FILE_CHARACTER(IMAGE_FILE_CHARACTER *val, char type);
void PauseIMAGE_FILE_HEADER(IMAGE_FILE_HEADER *val, char type);
void PauseIMAGE_NT_OPTIONAL_MAGIC(IMAGE_NT_OPTIONAL_MAGIC *val, char type);
void PauseIMAGE_NT_SUBSYSTEM(IMAGE_NT_SUBSYSTEM *val, char type);
void PauseIMAGE_DATA_DIRECTORY(IMAGE_DATA_DIRECTORY *val, char type);
void PausePEULONG(PEULONG *val, char type);
void PauseIMAGE_OPTIONAL_HEADER(IMAGE_OPTIONAL_HEADER *val, char type);
void PauseIMAGE_NT_HEADERS(IMAGE_NT_HEADERS *val, char type);
void PauseIMAGE_SECTION_CHARACTER(IMAGE_SECTION_CHARACTER *val, char type);
void PauseIMAGE_SECTION_HEADER(IMAGE_SECTION_HEADER *val, char type);
void PauseIMAGE_PE_FILE(IMAGE_PE_FILE *val, char type);

#ifdef __cplusplus
}
#endif

#endif
